
from sqlalchemy import Column, Integer, String, Float, DateTime, UniqueConstraint, Boolean

from QualityInspectionViolation.DbInit.mysqlDb import Base


class Customer(Base):
    __tablename__ = 'customer'
    id = Column(Integer, primary_key=True)
    name = Column(String(32))
    adviserId = Column(Integer)
    adviserName = Column(String(32))
    ordeRestriction = Column(Boolean)
    createdAt = Column(DateTime)
    updatedAt = Column(DateTime)

    def updateCustomer(self, customerId, session):
        session.query(Customer). \
            filter(Customer.id == customerId). \
            update({"ordeRestriction": False})